<template>
  <div class="menu">
    <ul>
      <li :class="indexActive === index ? 'active' : ''" v-for="(item, index) in list" :key="item.index" @click="changeMenu(index)">
        <i style="font-size:24px;margin-right:10px;" :class="item.icon"></i>{{item.name}}
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "Menu",
  data() {
    return {
      list: [{
        icon: 'el-icon-office-building',
        name: 'excel比对生成'
      }, {
        icon: 'el-icon-s-data',
        name: '数据可视化'
      }, {
        icon: 'el-icon-info',
        name: '软件信息'
      }],
      indexActive: 0
    }
  },
  methods: {
    changeMenu(index) {
      this.indexActive = index
      if (index === 0 && this.$route.path !== '/upload') {
        this.$router.push('/upload')
      }
      if (index === 2 && this.$route.path !== '/about') {
        this.$router.push('/about')
      }
    }
  }
};
</script>
<style lang="stylus" scope>
ul {
  margin: 0;
  padding: 0;
}

.menu {
  position: fixed;
  width: 200px;
  height: 589px;
  top: 40px;
  background: #21252b;

  ul {
    width: 100%;
    height: 80%;
    display: flex;
    flex-direction: column;
    margin-top: 15px;
  }

  li {
    width: 100%;
    user-select none;
    // padding: 20px 0 0 0;
    font-size: 15px;
    height: 60px;
    line-height: 60px;
    cursor: pointer;
    font-weight: bold;
    color: #d6d1d1;
    text-align: center;
    transition: all 0.5s ease;
  }

  .active {
    background: #282c34 !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    // color: #fff;
    color: rgba(102, 177, 255, 1);
  }

  li:hover {
    background: #282c34;
  }
}
</style>